<?php
include_once '../../__global.php';

class aj_invite3rdFriend extends ml_controller{
    
    private $content;
    
    function initParam() {
        $this->content = $this->input('content', 'P', '');
        $this->content = preg_replace('/\s+/',' ', $this->content);
    }
    
    function main() {
    
    
        $uid = $this->__visitor['uid'];            //当前登录用户uid

        $o3rd = new ml_model_db3rdService();
        $rs = $o3rd -> get3rdServiceUser($uid,1 ,$serData);
        
        if($rs){
                $wb['access_token']=$serData['access_token'];
        }else{
                $session=$this->getSession();
                $wb['access_token']=$session->getVal ( 'access_token' );
        }
        
        $wbcontent=urldecode($this->content);
        
        $wb['content']=$wbcontent;
        $service_id = 1; //weibo
        ml_tool_sendMq::send_3rdweibo($service_id,$wb);

        if($rs) { //  成功
            
            $this->api_output(ML_RCODE_SUCC);
        }else {  
            $this->api_output(ML_RCODE_FAIL,array(),'发布失败');
        }
    }
    
    
    
    function checkParam(){
        $this->check_referer();
        if(empty($this->content)){
            $this->api_output(ML_RCODE_PARAM , '', '内容不能为空');
        }
    }
}

new aj_invite3rdFriend();

